package webview

import (
	"gitee.com/snxamdf/wui/util/w"
)

type EventFn func(w WidgetInterface) *RPCData

type WidgetInterface interface {
	GoSyncJS()
	Eval(js string) error
	GetComponent() ComponentInterface
	CBEvent(EventFn) WidgetInterface
	GetEvent() EventFn
	GetValue() w.WMap
	GetId() string
	SetValue(value interface{})
}

type ComponentInterface interface {
	GetName() string
	NewWidget(widgetId string) WidgetInterface
	GetWidget(widgetId string) WidgetInterface
	GetWidgets() map[string]WidgetInterface
	SetWidget(widgetId string, w WidgetInterface) WidgetInterface
	GetWV() WV
}

type WV interface {
	IEval(js string) error
}

type Binding interface {
	BindingJS(widgets map[string]WidgetInterface)
	EvalJS(wv WV)
}
